package com.foreveross.common.filter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import com.foreveross.common.Constants;
import com.foreveross.common.PropertiesManagerParam;

public class InitializationParamServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static Logger log = Logger.getLogger(InitializationParamServlet.class);
	@Override
	public void init(ServletConfig config) throws ServletException {
		System.out.println("初始化参数开始.......");
		String path = config.getServletContext().getRealPath("");
		//系统参数初始化
		PropertiesManagerParam propertiesManagerParam = PropertiesManagerParam.getInstance();
		String propertiesPath =  config.getServletContext().getRealPath("/WEB-INF/basic_connection.properties");
				//path+File.separator+"WEB-INF"+File.separator+"basic_connection.properties";
		propertiesManagerParam.readProperties(propertiesPath, Constants.class);
		
		Constants.REAL_PATH = path;
		System.out.println("Constants.REAL_PATH:"+Constants.REAL_PATH);
		
		System.out.println("初始化参数完毕.......");
	}


}
